//
//  QRCodeResourceUtils.m
//  UniversalArchitecture
//
//  Created by chewyong on 15/12/7.
//  Copyright © 2015年 zhangli. All rights reserved.
//

#import "FFQRCodeResourceUtils.h"

@implementation FFQRCodeResourceUtils

+ (UIImage *)imagesNamedFromCustomBundle:(NSString *)imgName {
    NSBundle *containnerBundle = [NSBundle bundleForClass:[self class]];
    NSBundle *resourceBundle = [NSBundle bundleWithPath:[containnerBundle pathForResource:@"FFQRCode" ofType:@"bundle"]];
    NSString *img_path = [resourceBundle pathForResource:imgName ofType:@"png"];
    return [UIImage imageWithContentsOfFile:img_path];
}

+ (NSData *)wavDataFromCustomBundle:(NSString *)wavName {
    NSBundle *containnerBundle = [NSBundle bundleForClass:[self class]];
    NSBundle *resourceBundle = [NSBundle bundleWithPath:[containnerBundle pathForResource:@"FFQRCode" ofType:@"bundle"]];
    NSString *wav_path = [resourceBundle pathForResource:wavName ofType:@"wav"];
    NSData *data = [[NSData alloc] initWithContentsOfFile:wav_path];

    return data;
}

@end
